Skip to content

Conversation

@boostvolt
Copy link
Contributor

NormalizePathPrefix("") returns / for empty prefix, but URL construction appends /api/..., resulting in //api/health-checks/complete. This causes unnecessary 301 redirects on every health check.

Now returning "" for empty/root prefix instead of /.

Copilot AI review requested due to automatic review settings January 13, 2026 19:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a double slash issue in URLs when using an empty/root path prefix. The problem occurred because NormalizePathPrefix("") returned "/", which when concatenated with /api/... resulted in //api/..., causing unnecessary 301 redirects.

Changes:

  • Modified NormalizePathPrefix to return empty string for root paths ("" or "/") instead of "/"
  • Updated URL construction and conditional checks throughout the codebase to work with the new normalization behavior
  • Fixed a pre-existing bug where NormalizePathPrefix would return without trimming trailing slashes when adding a leading slash

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
handler.go Updated NormalizePathPrefix function to return empty string for root paths, simplified prefix assignment after normalization, updated middleware condition to check for empty string instead of "/", and fixed a bug in path prefix normalization logic
internal/riveruicmd/riveruicmd.go Simplified health check URL construction by removing redundant TrimSuffix call since normalized prefix never has trailing slashes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boostvolt thank you for this and sorry for the delay! I needed some time to add test coverage and manually verify it. We'll have it shipped in the next release.

@bgentry bgentry merged commit 58f4e53 into riverqueue:master Jan 19, 2026
7 of 17 checks passed
@bgentry
Copy link
Contributor

bgentry commented Jan 19, 2026

@boostvolt ah, I got ahead of myself, would you be able to add yourself to the CLA at https://github.com/riverqueue/rivercla ?

bgentry added a commit that referenced this pull request Jan 19, 2026
@boostvolt
Copy link
Contributor Author

@bgentry Done! Just signed the CLA (riverqueue/rivercla#17). Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants